package com.example.mcdonaldapplication.activity

import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.mcdonaldapplication.databinding.ActivityUserBinding

class UserActivity : AppCompatActivity() {
    private lateinit var binding:ActivityUserBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityUserBinding.inflate(layoutInflater)
        setContentView(binding.root)
        supportActionBar?.hide()
        getUser()
    }

    private fun getUser(){
        val prefs = getSharedPreferences("user", Context.MODE_PRIVATE)
        val username = prefs.getString("username", "")
        val integral = prefs.getInt("integral", 0).toString()
        val birthday = prefs.getString("birthday","")
        val phone = prefs.getString("mobile","")
        val sex = prefs.getString("gender","")
        val uid = prefs.getInt("uid", 0).toString()
        binding.tvUsername.text = username
        binding.tvSex.text = sex
        binding.tvPhone.text = phone
        binding.tvBirthday.text = birthday
        binding.tvUserID.text = uid
        binding.tvInt.text = integral
    }
}